//
//  VideoViewController.m
//  VideoExport
//
//  Created by Burn on 2019/4/30.
//  Copyright © 2019 menksoft. All rights reserved.
//

#define SCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width
#define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height

#import "VideoViewController.h"
#import "UINavigationController+FDFullscreenPopGesture.h"
#import "VideoView.h"

@interface VideoViewController ()<VideoViewDelegate>

/***/
@property(strong,nonatomic) VideoView *videoView;

@end

@implementation VideoViewController


- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.videoView viewWillAppear:animated];
    [self.videoView resume];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.videoView viewWillDisappear:animated];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.fd_prefersNavigationBarHidden = YES;
    
    self.videoView = [[VideoView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH , SCREEN_WIDTH * 9 / 16) andURL:@"https://media.w3.org/2010/05/sintel/trailer.mp4"];
    self.videoView.backgroundColor = [UIColor clearColor];
    self.videoView.delegate = self;
    [self.view addSubview:self.videoView];
    
}


// 返回值要必须为NO
- (BOOL)shouldAutorotate {
    return NO;
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    return UIStatusBarStyleLightContent;
}

- (BOOL)prefersStatusBarHidden {
    return SPPlayerShared.isStatusBarHidden;
}

- (void)popClick{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)dealloc{
    NSLog(@"VideoViewController-dealloc");
}

@end
